<template>
	<view class="index" :style="{ paddingTop: statusBarHeight + 'px' }">
		<login v-show="!address"></login>
		<homePage @showPopup="openPopup" v-show="address"></homePage>
		<tabbar :selectedIndex="0"></tabbar>
		<view class="popup-overlay" v-if="address">
			<uni-popup ref="popup" type="bottom" :is-mask-click="false" @maskClick="closePopup" class="popup"
				background-color="#FFFFFF" border-radius="10px 10px 0 0">
				<switchWallet @closePopup="closePopup"></switchWallet>
			</uni-popup>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				statusBarHeight: 0
			}
		},
		computed: {
			address() {
				return this.$store.getters.getAddress;
			},
		},
		onLoad() {},
		onShow() {
			uni.hideTabBar()
		},
		created() {
			// 获取系统信息
			uni.getSystemInfo({
				success: (res) => {
					this.statusBarHeight = res.statusBarHeight; // 设置状态栏高度
				}
			});
		},
		methods: {
			openPopup() {
				this.$refs.popup.open('bottom')
			},
			closePopup() {
				this.$refs.popup.close()
			},
		}
	}
</script>

<style lang="scss" scoped>
	.index {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		font-weight: 400;
		.tabbar{
			width: 100%;
			height: 110upx;
		}
	}
</style>